package dao

import (
	"database/sql"
	"github.com/google/wire"
	"log"
	"week4/internal/model"
)

type UserRepository interface {
	AddUser()
}

type UserRepositoryImpl struct {
	*sql.DB
}

func (u *UserRepositoryImpl) AddUser() {
	user := &model.User{}
	if user != nil {
		user.Id = 123
		user.Name = "ma"
	}
	log.Println("add user name: " + user.Name)
}

func NewUserRepositoryImpl(db *sql.DB) *UserRepositoryImpl {
	return &UserRepositoryImpl{}
}

var UserSet = wire.NewSet(NewUserRepositoryImpl,
	wire.Bind(new(UserRepository), new(*UserRepositoryImpl)))
